<!--
 * @Author: your name
 * @Date: 2021-09-16 17:29:16
 * @LastEditTime: 2021-11-05 14:41:40
 * @LastEditors: Please set LastEditors
 * @Description: In User Settings Edit
 * @FilePath: \jingfeng-web\src\components\removeDialog\removeDialog.vue
-->
<template>
  <div>
    <!-- 删除弹出框 -->
    <CommonDialog
      title="删除"
      width="30%"
      v-bind:dialogVisible="deleteDialogVisible"
      @on-change-dialogVisible="deleteChange"
      class="delete"
      top="10vh"
    >
      <template #body>
        <div class="deleteMessage">确定删除该数据吗？</div>
      </template>
      <template #dialog_footer>
        <el-button class="submitCancel delete" @click="deleteCancel">取 消</el-button>
        <el-button type="primary" @click="deleteConfirm" class="submitReme delete">删除</el-button>
      </template>
    </CommonDialog>
  </div>
</template>

<script>
import CommonDialog from '@/components/commonDialog/commonDialog.vue'
import { FeedBack } from '@/api/feedBack/server'
export default {
    name: '',
    components: {
        CommonDialog
    },
    props: {},
    data() {
        return {
            // 控制删除弹出框
            deleteDialogVisible: false,
            tableItemsId: ''
        }
    },
    computed: {},
    watch: {},
    created() {},
    mounted() {},
    methods: {
        show(id) {
            this.tableItemsId = id
            this.deleteDialogVisible = true
        },
        deleteCancel() {
            this.deleteDialogVisible = false
        },
        deleteChange(val) {
            this.deleteDialogVisible = val
        },
        // 确认删除
        deleteConfirm() {
            this.DeleteAsync({ id: this.tableItemsId })
        },
        // 删除反馈列表数据byId
        async DeleteAsync(id) {
            try {
                const result = await FeedBack.DeleteAsync(id)
                if (result.success) {
                    this.deleteDialogVisible = false
                    this.tableItemsId = ''
                    this.$emit('refreshPage')
                }
            } catch (error) {
                console.log(error)
            }
        }
    }
}
</script>
